package client;

import java.awt.BorderLayout;
import java.net.MalformedURLException;
import java.rmi.*;
import java.awt.FlowLayout;

import javax.naming.ConfigurationException;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;

import server.CompanyInterface;
import server.DeveComInterface;
import server.EnterpriceInterface;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class DeveComInfo_GUI extends JDialog {

	private final JPanel contentPanel = new JPanel();

	/**
	 * Launch the application.
	 *//*
	public static void main(String[] args) {
		try {
			DeveComInfo_GUI dialog = new DeveComInfo_GUI();
			dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
			dialog.setVisible(true);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Create the dialog.
	 */
	public DeveComInfo_GUI()throws ConfigurationException , RemoteException ,MalformedURLException,NotBoundException {
		setTitle("\u672C\u516C\u53F8\u57FA\u672C\u4FE1\u606F");
		setModalityType(ModalityType.APPLICATION_MODAL);
		setBounds(100, 100, 450, 300);
		getContentPane().setLayout(new BorderLayout());
		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
		getContentPane().add(contentPanel, BorderLayout.CENTER);
		contentPanel.setLayout(null);
		{
			JLabel label = new JLabel("\u540D\u79F0\uFF1A");
			label.setBounds(62, 10, 54, 15);
			contentPanel.add(label);
		}
		{
			JLabel label = new JLabel("\u94F6\u884C\u8D26\u6237\uFF1A");
			label.setBounds(62, 35, 67, 15);
			contentPanel.add(label);
		}
		{
			JLabel label = new JLabel("\u8D26\u6237\u8D44\u91D1\uFF1A");
			label.setBounds(62, 60, 67, 15);
			contentPanel.add(label);
		}
		{
			JLabel label = new JLabel("\u8D37\u6B3E\u91D1\u989D\uFF1A");
			label.setBounds(62, 85, 67, 15);
			contentPanel.add(label);
		}
		{
			JLabel label = new JLabel("\u8D37\u6B3E\u91D1\u989D\u4E0A\u9650\uFF1A");
			label.setBounds(62, 110, 107, 15);
			contentPanel.add(label);
		}
		{
			JLabel label = new JLabel("\u804C\u5458\u4EBA\u6570\uFF1A");
			label.setBounds(62, 135, 67, 15);
			contentPanel.add(label);
		}
		{
			JLabel label = new JLabel("\u804C\u5458\u4E0A\u9650\uFF1A");
			label.setBounds(62, 160, 67, 15);
			contentPanel.add(label);
		}
		{
			JLabel lblNewLabel = new JLabel("\u5F53\u524D\u8BBE\u5907\u7B49\u7EA7\uFF1A");
			lblNewLabel.setBounds(62, 185, 107, 15);
			contentPanel.add(lblNewLabel);
		}
		{
			JLabel label = new JLabel("\u6700\u65B0\u8BBE\u5907\u7B49\u7EA7\u4E0A\u9650\uFF1A");
			label.setBounds(62, 210, 118, 15);
			contentPanel.add(label);
		}
		
		
		
		try
		{
			Configuration config=new Configuration();
			String rmiAddress=config.getRmiAddress();

			DeveComInterface DCI=(DeveComInterface) Naming.lookup(rmiAddress+"DeveCom");
			CompanyInterface CI=(CompanyInterface) Naming.lookup(rmiAddress+"Company");
			EnterpriceInterface EI=(EnterpriceInterface) Naming.lookup(rmiAddress+"Enterprice");
		{
			JLabel label = new JLabel(EI.getName(EnterDeveCom_GUI.ComID));
			label.setBounds(215, 10, 54, 15);
			contentPanel.add(label);
		}
		{
			String bai =String.valueOf(EI.getBankAccountID(EnterDeveCom_GUI.ComID));
			JLabel label = new JLabel(bai);
			label.setBounds(215, 35, 54, 15);
			contentPanel.add(label);
		}
		{
			String f =String.valueOf(CI.getFounds(EnterDeveCom_GUI.ComID));
			JLabel label = new JLabel(f);
			label.setBounds(215, 60, 54, 15);
			contentPanel.add(label);
		}
		{
			String lv=String.valueOf(CI.getLoanVal(EnterDeveCom_GUI.ComID));
			JLabel label = new JLabel(lv);
			label.setBounds(215, 85, 54, 15);
			contentPanel.add(label);
		}
		{
			String mlv=String.valueOf(CI.getMaxLoanVal(EnterDeveCom_GUI.ComID));
			JLabel label = new JLabel(mlv);
			label.setBounds(215, 110, 54, 15);
			contentPanel.add(label);
		}
		{
			String sn=String.valueOf(CI.getStaffNum(EnterDeveCom_GUI.ComID));
			JLabel label = new JLabel(sn);
			label.setBounds(215, 135, 54, 15);
			contentPanel.add(label);
		}
		{
			String ms=String.valueOf(CI.getMaxStaff(EnterDeveCom_GUI.ComID));
			JLabel label = new JLabel(ms);
			label.setBounds(215, 160, 54, 15);
			contentPanel.add(label);
		}
		{
			String el=String.valueOf(DCI.getEquipmentLev(EnterDeveCom_GUI.ComID));
			JLabel label = new JLabel(el);
			label.setBounds(215, 185, 54, 15);
			contentPanel.add(label);
		}
		{
			String mel=String.valueOf(DCI.getMaxEquipmentLev(EnterDeveCom_GUI.ComID));
			JLabel label = new JLabel(mel);
			label.setBounds(215, 210, 54, 15);
			contentPanel.add(label);
		}
		
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
		{
			JPanel buttonPane = new JPanel();
			buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
			getContentPane().add(buttonPane, BorderLayout.SOUTH);
			
			{
				JButton cancelButton = new JButton("Cancel");
				cancelButton.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent e) {
						dispose();
						DeveComWorker_3_GUI dialog = new DeveComWorker_3_GUI();
						dialog.setLocationRelativeTo(null);
						dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
						dialog.setVisible(true);
					}
				});
				cancelButton.setActionCommand("Cancel");
				buttonPane.add(cancelButton);
			}
		}
	}

}
